package com.ruoyi.common.distributeLock.context;

import lombok.Data;
import org.apache.commons.collections4.MapUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author gim 2023/4/19 15:42
 */
@Data
public class ZkContext {
    private Map<String,String> pathMap;
    private String path;
    private String threadName;

    public void setZkPath(String threadName,String path){
        if(MapUtils.isEmpty(pathMap)){
            pathMap=new HashMap<>();
        }
        pathMap.put(threadName,path);
    }

    public String getZkPath(String threadName){
        return pathMap.get(threadName);
    }
}
